<%-- <%@page import="qldc.pm.tienan.service.LichSuXoaAnTichLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.service.LichSuXoaAnTichLocalService"%>
<%@page import="qldc.pm.tienan.model.LichSuXoaAnTich"%>
<%@page import="qldc.pm.qtht.dmdc.utils.DiaChiUtils"%>
<%@page import="qldc.pm.tienan.model.TienAn"%>
<%@page import="qldc.pm.tienan.service.TienAnLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.service.DoiTuongTienAnLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.service.TinhLocalServiceUtil"%>
<%@page import="java.util.List"%>
<%@page import="qldc.pm.qtht.dmdc.model.Tinh"%>
<%@page import="qldc.pm.tienan.searchcontainer.DSLichSuPhamToiSearchTerms"%>
<%@page import="qldc.pm.tienan.searchcontainer.DSLichSuPhamToiDisplayTerms"%>
<%@page import="qldc.pm.tienan.searchcontainer.DSLichSuPhamToiSearch"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="qldc.pm.tienan.constants.TienAnConstants"%>
<%@page import="java.util.Date"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="java.text.SimpleDateFormat"%>

<%@include file="../../init.jsp"%>

<%
	PortletURL portletURL = renderResponse.createRenderURL();
	portletURL.setParameter("mvcPath", "/html/view.jsp");
	portletURL.setParameter("chonChucNangItem",
			TienAnConstants.DS_BKTT);
	portletURL.setParameter("loaiBKTK",
			TienAnConstants.LICH_SU_PHAM_TOI);
	PortletURL thoatUrl =  renderResponse.createRenderURL();
	thoatUrl.setParameter("mvcPath", "/html/view.jsp");
	thoatUrl.setParameter("chonChucNangItem",
	TienAnConstants.BAO_CAO_THONG_KE);
	String pathThemeImages = themeDisplay.getPathThemeImages();
%>

<portlet:resourceURL var="loadQuanHuyen" id="loadQuanHuyen">
	<portlet:param name="tinhIdSelected" value="{0}" />
</portlet:resourceURL>

<portlet:resourceURL var="loadPhuongXa" id="loadPhuongXa">
	<portlet:param name="quanHuyenIdSelected" value="{0}" />
</portlet:resourceURL>




<fieldset>
	<legend>
		<liferay-ui:message key="danh-sach-lich-su-pham-toi" />
	</legend>
	<form action="<%=portletURL.toString()%>" method="POST">
		<%
			SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
			DSLichSuPhamToiSearch dsLichSuPhamToiSearch = new DSLichSuPhamToiSearch(
					renderRequest, portletURL);
			DSLichSuPhamToiDisplayTerms displayTerms = (DSLichSuPhamToiDisplayTerms) dsLichSuPhamToiSearch
					.getDisplayTerms();
			DSLichSuPhamToiSearchTerms searchTerms = (DSLichSuPhamToiSearchTerms) dsLichSuPhamToiSearch
					.getSearchTerms();
			long noiThuongTruTinhIdSelected = searchTerms.getTinhId();
			long noiThuongTruQuanHuyenIdSelected = searchTerms.getQuanHuyenId();
			long noiThuongTruPhuongXaIdSelected = searchTerms.getPhuongXaId();
			int sttDoiTuong = dsLichSuPhamToiSearch.getDelta() * (dsLichSuPhamToiSearch.getCur() - 1);
		%>
		<table class="gridnormal">
			<tr>
				<td><label><liferay-ui:message key="so-dinh-danh-ca-nhan" /></label></td>
				<td><input type="text" name="<portlet:namespace/>soDinhDanhCaNhan" id="<portlet:namespace/>soDinhDanhCaNhan" /></td>
			</tr>
			<tr>
				<td><label><liferay-ui:message key="ho-va-ten" /></label></td>
				<td><input type="text" name="<portlet:namespace/>hoVaTen" id="<portlet:namespace/>hoVaTen" /></td>
			</tr>
			<tr>
				<td><liferay-ui:message key="noi-thuong-tru" /></td>

				<td colspan="2"><select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruTinhId" id="<portlet:namespace/>noiThuongTruTinhId"
					onchange="loadQuanHuyen('<portlet:namespace />noiThuongTruTinhId', '<portlet:namespace />noiThuongTruQuanHuyenId', '<portlet:namespace />noiThuongTruPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiThuongTruQuanHuyenIdSelected%>');">
						<%
							List<Tinh> tinhs = TinhLocalServiceUtil.findAll();

							for (Tinh tinh : tinhs) {
						%>
						<option value="<%=tinh.getTinhId()%>" <%=(noiThuongTruTinhIdSelected == tinh.getTinhId() || tinh
						.isLaMacDinh()) ? "selected=selected"
						: StringPool.BLANK%>><%=tinh.getTenTinh()%></option>
						<%
							}
						%>
				</select> <select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruQuanHuyenId" id="<portlet:namespace/>noiThuongTruQuanHuyenId" onchange="loadPhuongXa('<portlet:namespace/>noiThuongTruQuanHuyenId', '<portlet:namespace/>noiThuongTruPhuongXaId', '<%=loadPhuongXa.toString()%>', '<%=noiThuongTruPhuongXaIdSelected%>');"></select>

					<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruPhuongXaId" id="<portlet:namespace/>noiThuongTruPhuongXaId"></select></td>
				<td><input type="text" name="<portlet:namespace/>noiThuongTruDiaChi" id="<portlet:namespace/>noiThuongTruDiaChi" value="<%=searchTerms.getDiaChi()%>" /></td>
			</tr>

		</table>
		<div align="left">
			<input type=submit  class="btn btn-primary" name="<portlet:namespace/>Tim" value="<liferay-ui:message key="tim" />" /> <input type=button class="btn"  name="<portlet:namespace/>in" value="In" />
			<input type=button class="btn"  name="<portlet:namespace/>thoat" value="Thoat"  onclick="window.location = '<%=thoatUrl.toString() %>';" />
		</div>
	</form>

	<table class="table table-bordered table-striped">
		<thead class="table-columns">
			<tr color='blue'>
				<th class="table-first-header"><liferay-ui:message key="ngay-pham-toi" /></th>
				<th class=""><liferay-ui:message key="toi-danh" /></th>
				<th class=""><liferay-ui:message key="toa-an-xu-phat" /></th>
				<th class=""><liferay-ui:message key="noi-dung-xu-phat" /></th>
				<th class=""><liferay-ui:message key="xoa-an-tich" /></th>
				<th class=""><liferay-ui:message key="nhan-xet-xoa-an-tich" /></th>
				<th class=""><liferay-ui:message key="ngay-xoa-an-tich" /></th>
				<th class="table-last-header"><liferay-ui:message key="nguoi-ky-xoa-an-tich" /></th>
			</tr>
		</thead>
		<tbody class="table-data">
			<liferay-ui:search-container emptyResultsMessage="khong-tim-thay-lich-su-pham-toi">
				<liferay-ui:search-container-results>
					<%
				results = DoiTuongTienAnLocalServiceUtil.findByLichSuPhamToi(
								searchTerms.getSoDinhNhanCaNhan(),
								searchTerms.getHoVaTen(),
								searchTerms.getTinhId(),
								searchTerms.getQuanHuyenId(),
								searchTerms.getPhuongXaId(),
								searchTerms.getDiaChi(),
								dsLichSuPhamToiSearch.getStart(), dsLichSuPhamToiSearch.getEnd());

						total = DoiTuongTienAnLocalServiceUtil.countByLichSuPhamToi(
								searchTerms.getSoDinhNhanCaNhan(),
								searchTerms.getHoVaTen(),
								searchTerms.getTinhId(),
								searchTerms.getQuanHuyenId(),
								searchTerms.getPhuongXaId(),
								searchTerms.getDiaChi());

						pageContext.setAttribute("results", results);
						pageContext.setAttribute("total", total);
			%>
				</liferay-ui:search-container-results>
				<liferay-ui:search-container-row className="qldc.pm.tienan.dto.DS_LichSuPhamToiDTO" keyProperty="doiTuongTienAnId" modelVar="hoSoTienAn">
					<tr class="">
						<td class="table-cell " style="background-color: #1078E1; color: white; font-weight: bolder;" colspan="13"><aui:fieldset>
								<aui:column columnWidth="8">
									<label for="hoVaTen"><liferay-ui:message key="ho-va-ten" /></label>
								</aui:column>
								<aui:column columnWidth="10">

									<%=hoSoTienAn.getHoVaTen() %>
								</aui:column>

								<aui:column columnWidth="10">
									<label for="diaChi"><liferay-ui:message key="dia-chi" /></label>
								</aui:column>
								<aui:column columnWidth="15">

									<%=hoSoTienAn.getDiaChi() %>
								</aui:column>

								<aui:column columnWidth="10">
									<label for="soDinhDanhCaNhan"><liferay-ui:message key="so-dinh-danh-ca-nhan" /></label>
								</aui:column>
								<aui:column columnWidth="15">

									<%=hoSoTienAn.getSoDinhDanhCaNhan() %>
								</aui:column>

								<aui:column columnWidth="10">
									<label for="soLanPhamToi"><liferay-ui:message key="so-lan-pham-toi" /></label>
								</aui:column>
								<aui:column columnWidth="10">
									<%=String.valueOf(hoSoTienAn.getSoLanPhamToi()) %>
								</aui:column>


							</aui:fieldset></td>
					</tr>

					<%
					long doiTuongId = hoSoTienAn.getDoiTuongTienAnId();
					List<TienAn> tienAns = TienAnLocalServiceUtil.findByDoiTuongTienAnId(doiTuongId);
					%>
					<c:if test="<%=null != tienAns && !tienAns.isEmpty() %>">
						<%
						for(TienAn tienAn: tienAns) {
							LichSuXoaAnTich lichSuXoaAnTich = null;
							String xoaAnTich = tienAn.getXoaAnTich() ? "Da Xoa An Tich" : "N/A";
							if(tienAn.getXoaAnTich() == true) {
								lichSuXoaAnTich = LichSuXoaAnTichLocalServiceUtil.findByTienAnId(tienAn.getTienAnId());
							}
							
		        	%>

						<tr>
							<td><%=sdf.format(tienAn.getNgayPhamToi()) %></td>
							<td><%=tienAn.getToiDanh() %></td>
							<td><%=tienAn.getToaAnXuPhat() %></td>
							<td><%=tienAn.getHinhPhatChinh() %></td>
							<td><%=xoaAnTich %></td>
							<td><%=lichSuXoaAnTich == null ? "N/A" : lichSuXoaAnTich.getNhanXet() %></td>
							<td><%=lichSuXoaAnTich == null ? "N/A" : sdf.format(lichSuXoaAnTich.getNgayXoaAnTich()) %></td>
							<td><%=lichSuXoaAnTich == null ? "N/A" : lichSuXoaAnTich.getNguoiKyDuyetXoaAnTich() %></td>
						</tr>

						<%
						}
		        	%>
					</c:if>
				</liferay-ui:search-container-row>
				<liferay-ui:search-iterator searchContainer="<%=dsLichSuPhamToiSearch%>" />
			</liferay-ui:search-container>
		</tbody>
	</table>
	<script type="text/javascript">
$(function() {
	 loadQuanHuyen('<portlet:namespace />noiThuongTruTinhId', '<portlet:namespace />noiThuongTruQuanHuyenId', '<portlet:namespace />noiThuongTruPhuongXaId', '<%=loadQuanHuyen.toString() %>','<%=noiThuongTruQuanHuyenIdSelected %>');
	 loadPhuongXa('<portlet:namespace/>noiThuongTruQuanHuyenId', '<portlet:namespace/>noiThuongTruPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiThuongTruPhuongXaIdSelected %>');
});
</script>
</fieldset>


 --%>